<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<script src="../js/vue.js"></script>
<style>
    /*  .fade-enter {
        opacity: 0;
        transform: translateX(0);
    }

    .fade-enter-active {
        transition: 3s;
    }

    .fade-enter-to {
        opacity: 1;
        transform: translateX(200px);
    }

    .fade-leave {
        opacity: 1;
    }

    .fade-leave-active {
        transition: 3s;
    }

    .fade-leave-to {
        opacity: 0;
    } */
    .v-enter {
        opacity: 0;
        transform: translateX(0);
    }

    .v-enter-active {
        transition: 3s;
    }

    .v-enter-to {
        opacity: 1;
        transform: translateX(200px);
    }

    .v-leave {
        opacity: 1;
    }

    .v-leave-active {
        transition: 3s;
    }

    .v-leave-to {
        opacity: 0;
    }
</style>

<body>
    <div id="app">
        <button @click="show=!show">切换</button>
        <!-- 过渡
        需求：显示时 没有 到有 transition  opacity 0-1
              隐藏时 有   到 没有    opacity 1 - 0 
        
        -->
        <!-- transition没有设置name时这六个属性为v-开头，如果有name,用name的值替换v -->
        <transition>
            <!-- 是否显示模板 v-if  v-show -->
            <h1 v-show="show">显示隐藏切换</h1>
        </transition>
    </div>
    <script>
        const vm = new Vue({
            el: "#app",
            data: {
                show: true
            }
        })
    </script>
</body>

</html>